package June;

public class Test_7_4 {
    public static void main(String[] args) {
        // 冒泡排序数组[24,69,80,57,13]

        int[] arr = {24, 69, 80, 57, 13, 100, -1};
        int tmp = 0;
        for (int i = 0; i < arr.length - 1; i++) {

            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr [j] > arr[j + 1]) {
                    tmp = arr[j];
                    arr [j] = arr[j + 1];
                    arr[j + 1]  = tmp;
                }
            }
            System.out.println("第" + (i + 1) + "次排序");

            for (int j = 0; j < arr.length; j++) {
                System.out.print(arr[j] + "  ");
            }
            System.out.println();
        }
    }
}
